package com.xintonghua.bussiness.adapter;

import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

import com.xintonghua.base.adapter.BaseAdapter;
import com.xintonghua.bussiness.R;
import com.xintonghua.bussiness.bean.EmployeeEvaluteBean;
import com.xintonghua.bussiness.bean.StaffManagerBean;
import com.xintonghua.bussiness.util.GlideUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 作者：wanxianyi
 * 时间：2018/4/24.
 * 包名：com.xintonghua.bussiness.adapter
 */

public class EmployeeEvaluteAdapter extends BaseAdapter<EmployeeEvaluteBean, EmployeeEvaluteAdapter.EmployeeViewHolder> {


    public EmployeeEvaluteAdapter(Activity mActivity, List<EmployeeEvaluteBean> list) {
        super(mActivity, list);
    }

    @Override
    public EmployeeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.adapter_employee_evalute, parent, false);
        return new EmployeeViewHolder(view);
    }

    @Override
    public void onBindViewHolder(EmployeeViewHolder holder, int position) {
        EmployeeEvaluteBean bean = list.get(position);
        holder.tvName.setText(bean.getNickname());
        GlideUtils.loadCricle(mActivity,holder.ivHead,bean.getHead_img());
        holder.tvEvaluate.setText(bean.getEvaluate());
        holder.rtNumber.setRating(bean.getLevel());
    }

    class EmployeeViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.iv_head)
        ImageView ivHead;
        @BindView(R.id.tv_name)
        TextView tvName;
        @BindView(R.id.rt_number)
        RatingBar rtNumber;
        @BindView(R.id.tv_evaluate)
        TextView tvEvaluate;

        public EmployeeViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
